setInitialFrame = function(frame) {
    application_url = document.location;
    frame.iu += '?page_id='+page_id+'&parent_url='+encodeURIComponent(application_url);
    if (frame.autoLoad)
        frame.iu += frame.autoLoad;
    iframe = '<iframe " src="' + frame.iu + '" width="' + frame.width + '" height="' + frame.height + '" scrolling="no" frameborder="0" id="'+ frame.id +'_iframe" name="' + frame.id + '_iframe"><\/iframe>';
    $('#'+frame.id).html(iframe);
};

setFinalFrame = function(frame) {
    iframe = document.getElementById(frame.id+"_iframe");
    $(iframe).attr('src', frame.fu);
    $(iframe).attr('height', 0);
    $(iframe).attr('width', 520);
    $(iframe).remove();
    $('#'+frame.id).show().parentsUntil('body').andSelf().siblings().hide();
    $('body').prepend(iframe);
    $('#'+frame.id+'_iframe').nextAll().hide();
    $(iframe).load(function() {$(iframe).attr('height', 1700); $(iframe).show();});
};

vtns_spotlight_receiveMessage = function(frame) {
  $.receiveMessage(function(e){
      if (e.data.substr(1,12) == 'app_data=job') {
          job_id = e.data.substr(16,e.data.length);
          if (job_id == 'all')
              frame.fu = frame.all_jobs_url;
          else
              frame.fu += e.data;

          setFinalFrame(frame);
      }
  }, protocol+"//"+embedded);
  setInitialFrame(frame);
};

vtns_filters_receiveMessage = function(frame) {
  $.receiveMessage(function(e){
      if (e.data.substr(1,12) != 'app_data=job') {
          frame.fu += e.data;
          setFinalFrame(frame);
      }
  }, protocol+"//"+embedded);
  setInitialFrame(frame);
};
